import cv2
import numpy as np

filename1 = r'C:\Users\Administrator\Desktop\building.jpg'
filename2 = r'C:\Users\Administrator\Desktop\building1.jpg'
image1 = cv2.imread(filename1)
image21 = cv2.imread(filename2)
image2= cv2.resize(image21,(int(image21.shape[1]/2),int(image21.shape[0]/2)))


orb = cv2.ORB_create()
kp1 = orb.detect(image1, None)
kp2 = orb.detect(image2, None)

bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)

kp1, des1 = orb.compute(image1, kp1)
kp2, des2 = orb.compute(image2, kp2)

image1 = cv2.drawKeypoints(image1,kp1,image1,color=(0,0,255), flags=0)
image2 = cv2.drawKeypoints(image2,kp2,image2,color=(0,0,255), flags=0)

matcher = bf.match(des1, des2)
img_mathes = cv2.drawMatches(image1, kp1, image2, kp2, matcher, None, (0, 0, 255))

cv2.imshow('image1',image1)
cv2.imshow('image2',image2)
cv2.imshow('ORB_img_matches',img_mathes)

cv2.waitKey(0)
cv2.destroyAllWindows()